#pragma once
#include <nice2d/predef.h>
#include <nice2d/serializer.h>

class ImageSet : public Serializer
{
    DECLARE_OBJECT(ImageSet)
public:
    ImageSet();
    ~ImageSet();
public:
    bool load(const std::string& file);
    sf::Vector2u getImageSize()const;

    bool addImage(const std::string& file,const sf::IntRect& area = {0,0,0,0});
    void visitImage(std::function<void(const std::string&,const sf::IntRect&)> visitor);

    PTree serialize()override;
    void deserialize(const PTree &node)override;
private:
    std::unique_ptr<class ImageSetData> data;
};
